<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>
        <p:dialog id="RegionEditDlg" widgetVar="RegionEditDialog" modal="true" resizable="false"  appendTo="@(body)" header="#{myBundle.EditRegionTitle}" closeOnEscape="true">

            <h:form id="RegionEditForm">

                <h:panelGroup id="display">
                    <p:panelGrid  columns="2" columnClasses="column" rendered="#{regionController.selected != null}">


                        <h:outputLabel value="#{myBundle.EditRegionLabel_idRegion}" for="idRegion" />
                        <h:panelGroup>
                            <h:outputText id="idRegion" value="#{regionController.selected.idRegion}" />
                            <p:tooltip for="idRegion" value="#{regionController.getComponentMessages('idRegion', myBundle.EditRegionHelpText_idRegion)}"/>
                        </h:panelGroup>

                        <p:outputLabel value="#{myBundle.EditRegionLabel_nombre}" for="nombre" />
                        <h:panelGroup>
                            <p:inputText id="nombre" value="#{regionController.selected.nombre}" title="#{myBundle.EditRegionTitle_nombre}" required="true" requiredMessage="#{myBundle.EditRegionRequiredMessage_nombre}" size="64" maxlength="64"/>
                            <p:tooltip for="nombre" value="#{regionController.getComponentMessages('nombre', myBundle.EditRegionHelpText_nombre)}"/>
                        </h:panelGroup>

                        <p:outputLabel value="#{myBundle.EditRegionLabel_idPais}" for="idPais" />
                        <h:panelGroup>
                            <p:selectOneMenu id="idPais" value="#{regionController.selected.idPais}" required="true" requiredMessage="#{myBundle.EditRegionRequiredMessage_idPais}">
                                <f:selectItem itemLabel="#{myBundle.SelectOneMessage}"/>
                                <f:selectItems value="#{paisController.items}"
                                               var="idPaisItem"
                                               itemValue="#{idPaisItem}"
                                               itemLabel="#{idPaisItem.idPais.toString()}"
                                               />
                                <f:converter binding="#{paisConverter}"/>
                            </p:selectOneMenu>
                            <p:tooltip for="idPais" value="#{regionController.getComponentMessages('idPais', myBundle.EditRegionHelpText_idPais)}"/>
                        </h:panelGroup>
                    </p:panelGrid>
                    <p:commandButton actionListener="#{regionController.save}" value="#{myBundle.Save}" update="display,:RegionListForm:datalist,:growl" oncomplete="handleSubmit(xhr,status,args,RegionEditDialog);">
                        <p:confirm header="#{myBundle.ConfirmationHeader}" message="#{myBundle.ConfirmEditMessage}" icon="ui-icon-alert"/>
                    </p:commandButton>
                    <p:commandButton value="#{myBundle.Cancel}" onclick="RegionEditDialog.hide()"/>
                </h:panelGroup>

            </h:form>

        </p:dialog>

    </ui:composition>

</html>
